{extend name="layout/layout"/}
{block name="body"}
<body data-type="widgets">
{/block}
{block name="content"}

<div class="tpl-content-wrapper">

    <div class="container-fluid am-cf">
<div class="row">

    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <div class="widget-head am-cf">
                <div class="widget-title am-fl">栏目编辑</div>
                <div class="widget-function am-fr">
                    <a href="javascript:;" class="am-icon-cog"></a>
                </div>
            </div>
            <div class="widget-body am-fr">

                <form class="am-form tpl-form-border-form" id="form1" id="form1" action="" method="post">
                    <div class="am-form-group">
                        <label  class="am-u-sm-12 am-form-label am-text-left">栏目标题 <span class="tpl-form-line-small-title">Title</span></label>
                        <div class="am-u-sm-12">
                            <input type="text" class="tpl-form-input am-margin-top-xs" id="name" placeholder="请输入标题文字">
                            <small>请填写标题文字2-10字左右。</small>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label  class="am-u-sm-12 am-form-label am-text-left">栏目类型 <span class="tpl-form-line-small-title">Type</span></label>
                        <div class="am-u-sm-12  am-margin-top-xs">
                            <select data-am-selected="{searchBox: 1}" id="type" style="display: none;">
                                <option value="a">-The.CC</option>
                                <option value="b">夕风色</option>
                                <option value="o">Orange</option>
                            </select>

                        </div>
                    </div>

                    <div class="am-form-group">
                        <label  class="am-u-sm-12 am-form-label  am-text-left">是否启用</label>
                        <div class="am-u-sm-12">
                            <div class="tpl-switch">
                                <input type="checkbox" id="status" class="ios-switch bigswitch tpl-switch-btn am-margin-top-xs" checked="">
                                <div class="tpl-switch-btn-view">
                                    <div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>

                    <div class="am-form-group">
                        <label  class="am-u-sm-12 am-form-label am-text-left">排序 <span class="tpl-form-line-small-title">Order</span></label>
                        <div class="am-u-sm-1 " style="float: left;">
                            <input  type="text" value="50"  id="order" data-role="tagsinput"/>
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-sm-12 am-form-label am-text-left">单页内容 <span class="tpl-form-line-small-title">Title</span></label>
                        <div class="am-u-sm-12">
                            <script src="__ueditor__/ueditor.config.js" type="text/javascript"></script>
                            <script src="__ueditor__/ueditor.all.js" type="text/javascript"></script>
                            <textarea name="content" rows="100%" style="width:100%" id="myEditor"></textarea>
                            <script type="text/javascript">
                                var editor = new UE.ui.Editor();
                                editor.render("myEditor");
                            </script>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label class="am-u-sm-12 am-form-label  am-text-left" >SEO标题<span class="tpl-form-line-small-title">SEO</span></label>
                        <div class="am-u-sm-12">
                            <input type="text" class="am-margin-top-xs" id="title" placeholder="输入SEO标题">
                        </div>
                    </div>

                    <div class="am-form-group">
                        <label class="am-u-sm-12 am-form-label  am-text-left " >SEO关键字 <span class="tpl-form-line-small-title">SEO</span></label>
                        <div class="am-u-sm-12">
                            <input type="text" class="am-margin-top-xs"  id="key" placeholder="输入SEO关键字">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label class="am-u-sm-12 am-form-label  am-text-left"  >SEO描述 <span class="tpl-form-line-small-title">SEO</span></label>
                        <div class="am-u-sm-12">
                            <input type="text" class="am-margin-top-xs"  id="description" placeholder="输入SEO描述">
                        </div>
                    </div>


                    <div class="am-form-group">
                        <div class="am-u-sm-12 am-u-sm-push-12">
                            <button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success " onclick="sub()">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


</div>
</div>

<script>

    $(document).ready(function(){
        if ($("#status").prop('checked') == true) {
            var state = 10;
            $("#status").attr('value',10);
        } else {
            var state = 30;
            $("#status").attr("value",30);
        }
    })
    function  sub() {

        var name = $("#name").val();
        var type = $("#type").val();
        var status = $("#status").val();
        var order = $("#order").val();
        var content = editor.getContent("myEditor");
        var key=$("#key").val();
        var title=$("#title").val();
        var description=$("#description").val();
        //console.dir(content);
        $.ajax({
            url:"{:url('@column/doEdit')}",
            type:"post",
            data:{
                name:name,
                type:type,
                status:status,
                order:order,
                content:content,
                key:key,
                title:title,
                description:description
            },
            dataType:"json",
            async:"false",
            success:function(data){
                console.dir(data);
            }




        })




    }


</script>


{/block}

